package com.bw.mapper;

import com.bw.bean.Vo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @Author: lhy
 * @Date: 2025/3/11 13:44
 * @Description:
 **/
@Mapper
public interface VoMapper {
    @Select("select sum(amount) amount from order_info where date (create_time)='2023-01-06'")
    double getList1();

@Select("call proc1")
    List<Vo> getList2();

@Select("select bo.org_name   name,\n" +
        "       sum(tt.actual_distance)  distance,\n" +
        "       count(tt.id)  num,\n" +
        "       sum(timestampdiff(second, actual_start_time, actual_end_time)) 'time',\n" +
        "       sum(timestampdiff(second, actual_start_time, actual_end_time)) / count(tt.id) 'avgTime',\n" +
        "       sum(tt.actual_distance)/count(tt.id) 'avgDistance',\n" +
        "       rank() over (order by count(tt.id) desc ) pm\n" +
        "from transport_task tt\n" +
        "         left join line_base_info lbi on tt.line_id = lbi.id\n" +
        "         left join base_organ bo on lbi.org_id = bo.id\n" +
        "group by bo.org_name")
    List<Vo> getList3();
}
